#!/sbin/openrc-run

_logdir="/var/log/${RC_SVCNAME}"
command="ruby /usr/share/minidyndns/dns.rb"
command_args="${minidyndns_opts:="--config /etc/minidyndns_config.yml --db /var/lib/minidyndns/db.yml"}"
command_background="yes"

description_reload="Reloading configuration"
extra_started_commands="reload"

start_stop_daemon_args="--stdout $_logdir/access.log --stderr $_logdir/error.log"
stopsig="SIGINT"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	after firewall
}

reload() {
	ebegin "Reloading ${RC_SVCNAME}"
	start-stop-daemon --exec "$command" \
		--pidfile "$pidfile" --signal USR1
	eend $?
}
